export const throttle = (callback, delay = 200, immediate = false) => {
	let lastTime = 0,
		currentTime = 0;
	return (...args) => {
		currentTime = Date.now();
		if (lastTime === 0 && !immediate) return (lastTime = Date.now());
		if (lastTime !== 0 && currentTime - lastTime < delay) return;
		lastTime = Date.now();
		callback.call(this, ...args);
	};
};
